<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>笔下光年--管理后台</title>
    <link rel="shortcut icon" href="/static/admin/img/logo.jpg" type="image/x-icon">
    <link href="/static/admin/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/static/admin/css/font-awesome.min.css" rel="stylesheet" />
    <link href="/static/admin/css/weather-icons.min.css" rel="stylesheet" />
    <link id="beyond-link" href="/static/admin/css/beyond.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="login-container">
    <div class="loginbox bg-white">
        <form>
            <div class="loginbox-title">忘记密码</div>
            <div class="loginbox-or">
                <div class="or-line"></div>
            </div>
            <div class="loginbox-textbox">
                <input type="text" class="form-control" name="username" placeholder="输入用户名" />
            </div>
            <div class="loginbox-textbox hidden">
                <input type="text" class="form-control" name="code" placeholder="输入验证码" />
            </div>
            <div class="loginbox-textbox hidden">
                <input type="password" class="form-control" name="password" placeholder="输入新密码" />
            </div>
            <div class="loginbox-textbox hidden">
                <input type="password" class="form-control" name="conpass" placeholder="确认密码" />
            </div>
            <div class="loginbox-submit">
                <input type="submit" class="btn btn-primary btn-block" id="sendCode" value="获取验证码">
                <span style="color: #ff0000">验证码将发送至用户注册时所填写的邮箱内，请注意查收</span>
            </div>
            <div class="loginbox-submit hidden">
                <input type="submit" class="btn btn-primary btn-block" id="reset"  value="修改密码">
            </div>
            <div class="loginbox-signup">
                <a href="{:url('admin/index/login')}">返回登录</a>
            </div>
        </form>
    </div>
    <div class="logobox">
        <p class="text-center" style="font-size: 18px;font-weight: bold;text-shadow: 3px 3px 3px #FF0000;font-style: italic;">笔下光年</p>
    </div>
</div>

<script src="/static/admin/js/skins.min.js"></script>
<!--Basic Scripts-->
<script src="/static/admin/js/jquery.min.js"></script>
<script src="/static/admin/js/bootstrap.min.js"></script>
<script src="/static/admin/js/slimscroll/jquery.slimscroll.min.js"></script>
<!--Beyond Scripts-->
<script src="/static/admin/js/beyond.js"></script>
<script src="/static/lib/layer/layer.js"></script>
<script>
    $(window).bind("load", function () {

        /*Sets Themed Colors Based on Themes*/
        themeprimary = getThemeColorFromCss('themeprimary');
        themesecondary = getThemeColorFromCss('themesecondary');
        themethirdcolor = getThemeColorFromCss('themethirdcolor');
        themefourthcolor = getThemeColorFromCss('themefourthcolor');
        themefifthcolor = getThemeColorFromCss('themefifthcolor');

    });
    $(function(){
        $('#sendCode').click(function () {
            $.ajax({
                url:"{:url('admin/index/forget')}",
                type:'post',
                data:$('form').serialize(),
                dataType:'json',
                success:function(data){
                    if (data.code == 1){
                        $('[name=username]').parent().addClass('hidden');
                        $('[name=code]').parent().removeClass('hidden');
                        $('[name=password]').parent().removeClass('hidden');
                        $('[name=conpass]').parent().removeClass('hidden');
                        $('#sendCode').parent().addClass('hidden');
                        $('#reset').parent().removeClass('hidden');
                    } else {
                        layer.open({
                            title:'发送失败！',
                            content:data.msg,
                            icon:5,
                            anim:6
                        });
                    }
                }
            });
            return false;
        });

        $('#reset').click(function () {
            $.ajax({
                url:"{:url('admin/index/reset')}",
                type:'post',
                data:$('form').serialize(),
                dataType:'json',
                success:function (data) {
                    console.log(data);
                    if (data.code == 1){
                        layer.msg(data.msg,{
                            icon:6,
                            time:2000
                        },function () {
                            location.href = data.url;
                        });
                    } else {
                        layer.open({
                            title:'密码重置失败！',
                            content:data.msg,
                            icon:5,
                            anim:6
                        });
                    }
                }
            });
            return false;
        });

    });




</script>
</body>
<!--  /Body -->
</html>
